**************************************
*****Code for replicating analyses in
*****Carlin, Hellwig, Love, Martinez-Gallardo, & Singer, "When does the Public Get It Right? The Information Environment and the Accuracy of Economic Sentiment" 
*****Comparative Political Studies, forthcoming
**************************************
*****code for replicating Tables 2, A20, A21, & A22
**************************************
use "CHLMS_CPS_yr.dta", replace

/*Table 2*/
reg obj i.ccode ntlcm l.obj 
eststo M1
reg d.obj i.ccode d.ntlcm dl.obj 
eststo M2
reg icc i.ccode ntlcm obj l.icc 
eststo M3
reg d.icc i.ccode d.ntlcm d.obj ld.icc 
eststo M4
reg icc c.ntlcm##c.infoenvi l.icc 
eststo M5
reg icc c.obj##c.infoenvi l.icc 
eststo M6
estout M1 M2 M3 M4 M5 M6, cells(b(star fmt(2) label(Coef.)) se(par fmt(2) label(se))) starlevels(* 0.05 ** 0.01) stats(N r2, labels ("No. Obs." "R-Squared") fmt(2)) style(fixed)

/*Table A20*/
reg obj i.ccode ntlcm 
eststo M1
reg obj i.ccode ntlcm l.obj 
eststo M2
reg icc i.ccode ntlcm obj 
eststo M3
reg icc i.ccode ntlcm obj l.icc 
eststo M4
estout M1 M2 M3 M4, cells(b(star fmt(2) label(Coef.)) se(par fmt(2) label(se))) starlevels(* 0.05 ** 0.01) stats(N r2, labels ("No. Obs." "R-Squared") fmt(2)) style(fixed)

/*Table A21*/
reg d.obj i.ccode d.ntlcm 
eststo M1
reg d.obj i.ccode d.ntlcm ld.obj 
eststo M2
reg d.icc i.ccode d.ntlcm d.obj 
eststo M3
reg d.icc i.ccode d.ntlcm d.obj ld.icc 
eststo M4
estout M1 M2 M3 M4, cells(b(star fmt(2) label(Coef.)) se(par fmt(2) label(se))) starlevels(* 0.05 ** 0.01) stats(N r2, labels ("No. Obs." "R-Squared") fmt(2)) style(fixed)

/*Table A22*/
reg obj ntlcm l.obj
reg d.obj d.ntlcm ld.obj
gmm (obj - {b1}*ntlcm -{b2}*l.obj - {b0}), instruments (ntlcm l.obj)
gmm (d.obj - {b1}*d.ntlcm -{b2}*ld.obj - {b0}), instruments (d.ntlcm ld.obj)
